<?php /* Smarty version 2.6.18, created on 2009-12-14 01:47:12
         compiled from daasReport.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('function', 'cycle', 'daasReport.tpl', 119, false),array('modifier', 'number_format', 'daasReport.tpl', 130, false),)), $this); ?>
<div id="blanket" style="display:none;"></div>
<div id="newDAA" style="background-color:#fff;width:800px;z-index: 1002;display:none;position: absolute;"></div>
<div id="editDAA" style="background-color:#fff;width:500px;z-index: 1002;display:none;position: absolute;"></div>
<div id="download" style="position:absolute;background-color:#fff;width:400px;z-index: 1002;display:none;"></div>

<script>	
	var dn = new ekimo_drag_region("content","newDAA");
	var de = new ekimo_drag_region("content","editDAA");
</script>

<script type="text/javascript">	
	<?php echo '
		Calendar.setup({
	        inputField     :    "cal[date_mortality_from]",     // id of the input field
	        ifFormat       :    "%Y-%m-%d" ,    // format of the input field
	        displayArea    :    "date_mortality_from",
	        daFormat       :    "%Y-%m-%d",      // format of the display area
	        button         :    "f_trigger_c1",  // trigger for the calendar (button ID)
	        align          :    "Bl",           // alignment (defaults to "Bl")
	        singleClick    :    true,
			//onUpdate	   :    endDateChanged, //event to call after calendar is closed
	        weekNumbers    :    false,
	        zIndex		   :	2000
	    });
	'; ?>

	<?php echo '
		Calendar.setup({
	        inputField     :    "cal[date_mortality_to]",     // id of the input field
	        ifFormat       :    "%Y-%m-%d" ,    // format of the input field
	        displayArea    :    "date_mortality_to",
	        daFormat       :    "%Y-%m-%d",      // format of the display area
	        button         :    "f_trigger_c2",  // trigger for the calendar (button ID)
	        align          :    "Bl",           // alignment (defaults to "Bl")
	        singleClick    :    true,
			//onUpdate	   :    endDateChanged, //event to call after calendar is closed
	        weekNumbers    :    false,
	        zIndex		   :	2000
	    });
	'; ?>

</script>
<div id="main_content">
    	<h1>DAA List</h1>
			<div class="blue">
        	    <form action="" id="filterForm" >
        	        <table style="width: 100%">
        	            <tr>
        	                <td><label for="filter">Tanks:</label></td>
        	                <td><select name="user[tank]" onchange="doajaxAction('/account/orgDAAReport/reload/1',1,'result',document.getElementById('filterForm'))">
            	                <option value="">All Tanks</option>
        	                    <?php $_from = $this->_tpl_vars['orgTanks']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['tank']):
?>
        	                        <option value="<?php echo $this->_tpl_vars['tank']['tank_id']; ?>
"><?php echo $this->_tpl_vars['tank']['name']; ?>
</option>
        	                    <?php endforeach; endif; unset($_from); ?>
        	                </select></td>
        	            </tr>
        	            <tr>
        	                <td><label for="filter">MOID:</label></td>
        	                <td><select name="user[moid]" onchange="doajaxAction('/account/orgDAAReport/reload/1',1,'result',document.getElementById('filterForm'))">
        	                    <option value="">All Species</option>
        	                    <?php $_from = $this->_tpl_vars['moids']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['moid']):
?>
        	                        <option value="<?php echo $this->_tpl_vars['moid']['moid']; ?>
"><?php echo $this->_tpl_vars['moid']['moid']; ?>
</option>
        	                    <?php endforeach; endif; unset($_from); ?>
        	                </select></td>
        	            </tr>
        	            <tr>
        					<td><label for="filter">Attribute:</label></td>
        					<td><select name="user[size_code]" onchange="doajaxAction('/account/orgDAAReport/reload/1',1,'result',document.getElementById('filterForm'))">
        						<option value="">Any Size</option>
        						<?php $_from = $this->_tpl_vars['sizeCodes']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['code']):
?>
        							<option value="<?php echo $this->_tpl_vars['code']['size_code']; ?>
"><?php echo $this->_tpl_vars['code']['size']; ?>
</option>
        						<?php endforeach; endif; unset($_from); ?>
        					</select></td>
        	            </tr>
        	            <tr>
        	                <td style="width: 100px" nowrap><label for="filter">Record From:</label></td>
        	                <td nowrap>
        						<!-- <input name="user[date_mortality_from]" type="text" size="10" onchange="doajaxAction('/account/orgDAAReport/reload/1',1,'result',document.getElementById('filterForm'))"/>&nbsp;&nbsp;&nbsp;to:&nbsp;
        						<input name="user[date_mortality_to]" type="text" size="10" onchange="doajaxAction('/account/orgDAAReport/reload/1',1,'result',document.getElementById('filterForm'))"/> -->
        						<input style="float:left" type="hidden" name="user[date_mortality_from]" id="cal[date_mortality_from]" size="10"  onchange="doajaxAction('/account/orgDAAReport/reload/1',1,'result',document.getElementById('filterForm'))"/>
								<span id="date_mortality_from"  style="width:80px; display:block; float:left; height:15px; text-align:center;"></span>
								<input style="float:left" type="image" src="/app/default/www/images/calendar.jpg" align="absmiddle" id="f_trigger_c1" style="cursor: pointer; border: 0px ;" title="Date selector"/>
								<input type="hidden" name="dateYui" value="cal[date_mortality_from]/date_mortality_from/f_trigger_c1">
						</tr>
						<tr>
							<td style="width: 100px" nowrap><label for="filter">Record To:</label></td>
							<td nowrap><input style="float:left" type="hidden" name="user[date_mortality_to]" id="cal[date_mortality_to]" size="10"  onchange="doajaxAction('/account/orgDAAReport/reload/1',1,'result',document.getElementById('filterForm'))"/>
								<span id="date_mortality_to"  style="width:80px; display:block; float:left; height:15px; text-align:center;"></span>
								<input style="float:left" type="image" src="/app/default/www/images/calendar.jpg" align="absmiddle" id="f_trigger_c2" style="cursor: pointer; border: 0px ;" title="Date selector"/>
								<input type="hidden" name="dateYui" value="cal[date_mortality_to]/date_mortality_to/f_trigger_c2">
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								<input type="button" value="Save to Excel" onclick="saveToExcel();">
        						</td>
        	                <td style="width: 100px; text-align: right">
					<input type="button" value="New DAA" onclick="newDAA();" />
    				</td>
        	            </tr>
        	        </table>
        	    </form>
        	</div>
       
            <div id="result">
				<div>
					<table border="0" width="100%">
					<tr><td colspan="9"><hr></td></tr>
					<tr>
						<?php if ($this->_tpl_vars['daasList'][0]['tank_name'] <> ''): ?>
								<td align="center" style="padding-left: 5pt; padding-right: 5pt">Edit</td>
						<?php endif; ?>
						<td>Tank</td>
						<td>MOID</td>
						<td>Common Name</td>
						<td>Size</td>
						<td align="right">DAA Qty</td>
						<td align="right">DAA Amt</td>
						<td align="right">Mortality Date</td>
						<td>Reason</td>
					</tr>
					<tr><td colspan="9"><hr></td></tr>
					<?php $_from = $this->_tpl_vars['daasList']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['daa']):
?>
					<tr class="<?php echo smarty_function_cycle(array('values' => 'blue,notify'), $this);?>
">
						<?php if ($this->_tpl_vars['daa']['tank_name'] <> ''): ?>
							<td align="center">
							<a href="javascript:void(0);" onclick="editDAA('<?php echo $this->_tpl_vars['daa']['inventory_id']; ?>
','<?php echo $this->_tpl_vars['daa']['inventory_daa_id']; ?>
');" >Edit</a>
						</td>
						<?php endif; ?>
						<td><?php echo $this->_tpl_vars['daa']['tank_name']; ?>
</td>
						<td><?php echo $this->_tpl_vars['daa']['moid']; ?>
</td>
						<td><?php echo $this->_tpl_vars['daa']['common_name']; ?>
</td>
						<td><?php echo $this->_tpl_vars['daa']['size']; ?>
</td>
						<td align="right"><?php echo $this->_tpl_vars['daa']['quantity_daa']; ?>
</td>
						<td align="right"><?php echo $this->_tpl_vars['daa']['currency_mark']; ?>
&nbsp;<?php echo ((is_array($_tmp=$this->_tpl_vars['daa']['stock_amount'])) ? $this->_run_mod_handler('number_format', true, $_tmp, "2%d") : number_format($_tmp, "2%d")); ?>
</td>
						<td align="right"><?php echo $this->_tpl_vars['daa']['date_mortality']; ?>
</td>
						<td><?php echo $this->_tpl_vars['daa']['remark']; ?>
</td>
						
					</tr>
					<?php endforeach; endif; unset($_from); ?>
					</table>
				</div>
            </div><!-- results -->
            
</div>
<script language="javascript">
<?php echo '
	function newDAA(){
		doajaxAction("/account/editInventoryDAALine/inventoryId/0/inventoryDAAId/0",0,\'newDAA\');
		popup("newDAA");
	}
	function editDAA(inventoryId,inventoryDAAId){
		doajaxAction("/account/editInventoryDAALine/inventoryId/"+inventoryId+"/inventoryDAAId/"+inventoryDAAId,0,\'editDAA\');
		popup("editDAA");
	}
	function saveToExcel(){
		doajaxAction("/account/saveOrgDAAReport",0,\'download\');
		popup("download");
	}
'; ?>

</script>